<?php
require_once 'content.domain.php';
class Item {

    public $Xml;
    public $Title;
    public $Content;
    public $AppContent;
    public $ASIN;
    public $DetailPageURL;
    public $ListPrice;
    public $Price;
    public $SmallImage;
    public $MediumImage;
    public $LargeImage;
    public $CustomerReviews;

    public function convert($xml) {
        $item = $xml->Items->Item;

        $this->Title = $item->ItemAttributes->Title;
        $this->Content = $item->EditorialReviews->EditorialReview->Content;
        $this->AppContent = Content::getRandom();
        $this->ASIN = $item->ASIN;
        $this->DetailPageURL = 'http://www.amazon.com/dp/' . $item->ASIN . '?tag=' . AWS_TAG;
        $this->ListPrice = $item->ItemAttributes->ListPrice->FormattedPrice;
        $this->Price = $item->Offers->Offer->OfferListing->Price->FormattedPrice;
        $this->SmallImage = $item->SmallImage->URL;
        $this->MediumImage = $item->MediumImage->URL;
        $this->LargeImage = $item->LargeImage->URL;
        $this->CustomerReviews = $item->CustomerReviews->IFrameURL;

    }
}
?>
